
#ifndef SOCKET_HPP
#define SOCKET_HPP

#include <netinet/tcp.h>

namespace tulun
{
    class InetAddress;
    class Socket
    {
    private:
        const int sockfd_; // listenFd; RreaWriteFd;

    public:
        Socket(int sockfd);
        ~Socket();

        int fd() const;
        void bindAddress(const InetAddress &localAddr);
        void listen();
        int accept(InetAddress *peerAddr);
        void shutdownWrite();
        //------
        void setTcpNoDelay(bool on);
        void setKeepAlive(bool on);
        bool getTcpInfo(struct tcp_info *) const;
        bool getTcpInfoString(char *buff, int len) const;
    };
} // namespace tulun

#endif